import request from '@/axios';

export const dept = {
  deptListUrl: '/api/civil-system/dept/deptList'
};

export const getDeptList = (current, size, params) => {
  return request({
    url: dept.deptListUrl,
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const getTreeList = (current, size, params) => {
  return request({
    url: '/api/civil-system/dept/list',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/civil-system/dept/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/civil-system/dept/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: `/civil-system/dept/${row.id}`,
    method: 'put',
    data: row
  });
};

export const getDept = (id) => {
  return request({
    url: '/api/civil-system/dept/detail',
    method: 'get',
    params: {
      id
    }
  });
};
export const getDeptTree = () => {
  return request({
    url: '/api/civil-system/dept/tree',
    method: 'get'
  });
};

